home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / GameCreators / TADS / manuals / TEX / TADSDEF.TEX < prev    next >
Encoding:
Text File  |  1992-11-13  |  7.9 KB  |  237 lines

  1. % $Header: c:/tads/doc/RCS/tadsdef.tex 1.2 92/11/13 16:45:15 mroberts Exp $
  2. % tadsdef.tex   - General definitions for the TADS documentation.
  3. %
  4. % This file should be included in each TeX file making up the
  5. % TADS documentation.  It defines macros, fonts, and more.
  6. %
  7.  
  8. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. % Some General Definitions                                                    %
  10. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  11.  
  12. %
  13. % Fonts
  14. %
  15. \font\bigrm=cmr10 scaled\magstep5
  16. \font\bigss=cmss17 scaled\magstep0
  17. \font\bigssi=cmssi17 scaled\magstep0
  18. \font\twelverm=cmr12 scaled\magstep0
  19. \font\twelvebf=cmbx12 scaled\magstep0
  20. \font\tenbf=cmbx10
  21. \font\tenrm=cmr10
  22. \font\tenit=cmti10
  23. \font\seventeenrm=cmr17
  24. \font\chfont=cmr10 scaled 2000
  25. \font\smallcaps=cmr8
  26.  
  27. % quotation fonts
  28. \font\eightss=cmssq8
  29. \font\eightssi=cmssqi8
  30. \font\ninett=cmtt9
  31.  
  32.  
  33. %
  34. % Pagesize:  use about half an inch less than usual, to make the pages
  35. % a little less black and leave some room for binding.  Leave the vertical
  36. % size of the page alone.
  37. %
  38. \advance\hsize by-0.5in
  39. \vsize=44pc
  40. \newdimen\pageheight \newdimen\pagewidth
  41. \pageheight=\vsize   \pagewidth=\hsize
  42.  
  43. %
  44. % Paragraph layout:  use no indentation; leave some vertical blank space
  45. % between paragraphs intead.
  46. %
  47. \parindent=0pt
  48. \parskip=\medskipamount
  49.  
  50. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  51. % Here we define some macros useful for typesetting examples text.  These     %
  52. % examples will be shown in \tt mode, with appropriate indentation.           %
  53. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  54.  
  55. %
  56. % \lb and \rb put up left and right braces (respectively); they also
  57. % indent another tab stop.  These guys should be used in \tt mode for
  58. % example text only.
  59. %
  60. \def\lb{\char`\{\vskip0in\advance\leftskip1em\vskip0in}
  61. \def\rb{\vskip0in\advance\leftskip-1em\char`\}\vskip0in}
  62. \def\invislb{\vskip0in\advance\leftskip1em\vskip0in}
  63. \def\invisrb{\vskip0in\advance\leftskip-1em\vskip0in}
  64.  
  65. %
  66. % \example enters \tt mode, and sets up other nice things for an example;
  67. % specifically, we do a \medskip and then indents subsequent text.  This
  68. % macro also ensures that source line breaks will be obeyed.
  69. %
  70. \def\example{\tt\parskip=0pt\obeylines\medskip\advance\leftskip1em\vskip0in}
  71.  
  72. %
  73. % \object# puts up "#: object" and indents subsequent lines.
  74. % Should only be used in \tt mode.
  75. %
  76. \def\object#1{#1\vskip0in\advance\leftskip1em\vskip0in}
  77.  
  78. %
  79. % \endobj ends the object definition with an appropriately placed semicolon
  80. % and a \medskip.  Use only in \tt mode.
  81. %
  82. \def\endobj{\vskip0in\advance\leftskip-1em ;\medskip}
  83.  
  84.  
  85. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  86. % Page Layout Definitions                                                     %
  87. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  88.  
  89. %
  90. % Page footer definitions.  These are called when a chapter heading
  91. % is output to affect the pages that follow.
  92. %
  93. % The \rtitle macro is the title of the book; the \rhead is the running
  94. % chapter header.  \rtitle should stay the same throughout the book,
  95. % whereas \rhead is changed automatically by the \chapterhead macro.
  96. %
  97. \newdimen\realhsize
  98. \newdimen\realvsize
  99. \realhsize=\hsize
  100. \realvsize=\vsize
  101. \newif\iftitle
  102. \newif\ifchapter
  103. \newif\ifthinrule
  104. \def\rfoot{\relax}
  105. \def\footline{%
  106.  \ifodd\pageno\rightfootline \else\leftfootline\fi}
  107. \def\rightfootline{\hbox to\realhsize{%
  108.   \vbox to 10pt{}{\tenrm\hfil\rfoot\hskip0.5in\folio}}}
  109. \def\leftfootline{\hbox to \realhsize{%
  110.   \vbox to 10pt{}{\tenrm\folio\hskip0.5in\rtitle\hfil}}}
  111. \def\chfoot{%
  112.  \ifodd\pageno\rightchfoot \else\leftchfoot\fi}
  113. \def\rightchfoot{\hbox to\realhsize{%
  114.   \vbox to 10pt{}{\tenrm\hfil\folio}}}
  115. \def\leftchfoot{\hbox to \realhsize{%
  116.   \vbox to 10pt{}{\tenrm\folio\hskip0.5in\rtitle\hfil}}}
  117.   
  118. \def\rtitle{The TADS Author's Manual}
  119.  
  120. \def\onepageout#1{\shipout\vbox{
  121.   \offinterlineskip
  122.   \vbox to\pageheight{#1}
  123.   \vbox to 3pc{\vfill\iftitle\global\titlefalse\else%
  124.   \ifchapter\chfoot\global\chapterfalse\else\footline\fi\fi%
  125. \boxmaxdepth=\maxdepth}}
  126. \advancepageno
  127. }
  128.  
  129. \output{\onepageout{\unvbox255}}
  130.  
  131.  
  132. %
  133. % A Chapter definition displays a wizzy chapter header page, with the
  134. % indicated text, and adjusts the footer line to print the chapter name
  135. % and number along with the page number.
  136. %
  137. % At the end of the chapter preface page, put the \chapterbody macro to
  138. % go into regular chapter page mode.  Note also that a square bullet, to
  139. % provide a sense of termination to the blurb, can be added with the
  140. % macro \bull.
  141. %
  142. % Chapters, therefore, are defined like this:
  143. %
  144. %    \chapterheader{Chapter Two}{Commands}
  145. %        <chapter preface blurb>\bull
  146. %    \chapterbody
  147. %        <chapter body text...>
  148. %
  149.  
  150. \def\chapterheader#1#2#3{
  151. \message{#1 #2}                     % display a message
  152. \eject\null                         % start a new page
  153. \ifodd\pageno \else \vfill\eject\null \fi % yet another if it's now even
  154. \xdef\rfoot{{\tenit #1}\hskip0.25in{\tenbf #2}} % define new chapter footer
  155. \vskip 0.5in
  156. {\seventeenrm #1}
  157. \smallskip\hrule\smallskip
  158. {\chfont\hfill #2}
  159. \vskip 0.5in
  160. %\vbox{\hfill$\diamond$\hskip0.5in$\diamond$\hskip 0.5in$\diamond$\hfill\null}
  161. \vskip 0.5in
  162. \write\toc{\string\contitem{#3}{#2}{\number\pageno}}
  163. \thinruletrue
  164. } % end of macro \chapterheader
  165.  
  166. % \def\bull{\vrule height .9ex width .8ex depth -.1ex}  % square bullet
  167. \def\bull{\relax}                   % nuke the bullet; do nothing
  168.  
  169. \def\chapterbody{
  170. } % end of macro \chapterbody
  171.  
  172. \outer\def\endchapter{\ifodd\pageno \else\vfill\eject\null\fi
  173.  \begingroup\bigskip\vfill % start the quotes
  174.  \def\eject{\endgroup\eject} % end the quotes at the next \eject
  175.  \def\par{\ifhmode\/\endgraf\fi}\obeylines
  176. % \eightpoint
  177.  \let\tt=\ninett \baselineskip=10pt
  178.  \interlinepenalty=10000
  179.  \leftskip=0pt plus 40pc minus \parindent \parfillskip=0pt
  180.  \parskip=0pt
  181.  \let\rm=\eightss \let\sl=\eightssi \everypar{\sl}}
  182. \def\author#1(#2){\smallskip\noindent\rm--- #1\unskip\enspace(#2)}
  183.  
  184.  
  185. %
  186. % A major section puts up an hrule to introduce the section, and puts the
  187. % section header in 12-point boldface type.  A minor section is the same,
  188. % but with a 10-point boldface section title, and a thinner line.
  189. %
  190. \def\majorsection#1\par{%
  191. %\filbreak
  192. \vskip0.5in\message{#1}
  193. \ifthinrule \thinrulefalse\hrule \else \hrule height2pt \fi%
  194. \nobreak\medskip\leftline{\twelvebf #1}\nobreak\bigskip\nobreak}
  195.  
  196. \def\minorsection#1\par{%
  197. %\filbreak
  198. \vskip0.25in\message{#1}
  199. \hrule\nobreak\smallskip\leftline{\bf #1}\nobreak\bigskip\nobreak}
  200.  
  201.  
  202. %
  203. % Indexing macros.  These macros allow us to derive an index file
  204. % for later typesetting automatically as the manual is typeset.
  205. %
  206. \newwrite\inx
  207. \immediate\openout\inx=tadsindx
  208. \newif\ifsilent
  209. \def\specialhat{\ifmmode\def\next{^}\else\let\next=\beginxref\fi\next}
  210. \def\beginxref{\futurelet\next\beginxrefswitch}
  211. \def\beginxrefswitch{\ifx\next\specialhat\let\next=\silentxref
  212.  \else\silentfalse\let\next=\xref\fi \next}
  213. \catcode`\^=\active \let ^=\specialhat
  214. \def\silentxref^{\silenttrue\xref}
  215.  
  216. \chardef\bslash=`\\
  217. \def\xref{\futurelet\next\xrefswitch}
  218. \def\xrefswitch{\begingroup\ifx\next|\aftergroup\vxref %
  219.  \else\ifx\next\<\aftergroup\anglexref %
  220.   \else\aftergroup\normalxref \fi\fi \endgroup}
  221. \def\vxref|{\catcode`\\=\active \futurelet\next\vxrefswitch}
  222. \def\vxrefswitch#1|{\catcode`\\=0 %
  223.  \ifx\next\empty\def\xreftype{2}%
  224.    \def\next{{\tt\bslash\text}}%
  225.  \else\def\xreftype{1}\def\next{{\tt\text}}\fi %
  226.  \edef\text{#1}\makexref}
  227. {\catcode`\|=0 \catcode`\\=\active |gdef\{}}
  228. \def\anglexref\<#1>{\def\xreftype{3}\def\text{#1}%
  229.  \def\next{\<\text>}\makexref}
  230. \def\normalxref#1{\def\xreftype{0}\def\text{#1}\let\next=\text\makexref}
  231.  
  232. \def\makexref{\xdef\writeit{\write\inx{\text\space!\xreftype\space
  233.   \noexpand\number\pageno.}}\writeit
  234.  \ifsilent\ignorespaces\else\next\fi}
  235.  
  236.  
  237.